home *** CD-ROM | disk | FTP | other *** search
- //*****************************************************************
- //
- // hello.cxx Hello POET implemented model
- //
- // Implementation of the following classes:
- // Person
- // Programmer
- //
- // Remarks
- // This modul contains the model of the database classes
- // The model is independent from the user interface
- //
- // Author: BKS Software, April 91
- //
- //*****************************************************************
-
- // standard includes for the C++ & WINDOWS environment
- #include <stdlib.h>
- #include <stdio.h>
- #include <string.h>
-
- // general include file for the POET environment
- #include <poet.hxx>
-
- // the database model of the application
- #include <base.hxx>
- #include <hello.hxx>
-
- char * Address::Print( char * buffer )
- {
- sprintf( buffer, "%s, %d, %s", (char*)street, zip, (char*)city );
- return buffer;
-
- }
-
- //-------------------------------------------------------------------
-
- void Person::Init ()
- {
- name = "";
- firstnames.Clear ();
- adrs.Clear ();
- }
-
- //-------------------------------------------------------------------
-
- Person::~Person()
- {
- firstnames.Clear();
- adrs.Clear();
- }
-
- //-------------------------------------------------------------------
-
- char * Person::Print ( char * buffer )
- {
- int erc;
-
- sprintf ( buffer, "%s", (char *) name);
- // Firstnames
- PtString fname;
- for ( erc = firstnames.Seek (0L, PtSTART);
- erc == 0; erc = firstnames.Seek (1L, PtCURRENT) )
- {
- firstnames.Get (fname);
- strcat ( buffer, ", ");
- strcat ( buffer, (char *) fname );
- }
-
- // first address
- if ( adrs.Seek (0L, PtSTART) == 0 )
- {
- Address *adr;
- char buf2[100];
-
- adrs.Get ( adr );
- strcat ( buffer, ", ");
- strcat ( buffer, adr->Print ( buf2 ));
- adrs.Unget ( adr );
- }
- return buffer;
- }
-
- //-------------------------------------------------------------------
-
- Programmer::~Programmer()
- {
- ;
- }
-
- //-------------------------------------------------------------------
-
- void Programmer::Init ()
- {
- Person::Init ();
- exp_years = 0;
- language = "";
- }
-
- //-------------------------------------------------------------------
-
- char * Programmer::Print ( char * buffer )
- {
- char expstring[50];
-
- sprintf ( expstring, "%d", exp_years);
- Person::Print ( buffer );
- strcat ( buffer, ", ");
- strcat ( buffer, (char *) expstring);
- strcat ( buffer, ", ");
- strcat ( buffer, (char *) language);
- return buffer;
- }
-